<!DOCTYPE html>
<html>

<head>
  <script src="../node_modules/angular/angular.js"></script>
</head>

<body ng-app="demo">
  <div ng-controller="OtherController"></div>
  <script>
    // 定义一个模块
    const demo = angular.module('demo', [])
    // 定义一个服务
    demo.service('log', function () {
      return {
        info() {
          console.log('info')
        }
      }
    })

    demo.controller('OtherController', function ($injector) {
      const log = $injector.get('log')
      console.log(log.info())
    })
  </script>
</body>

</html>